<html>
<head><meta charset="utf-8"><title>breaking async/await · t-lang/wg-unsafe-code-guidelines · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/index.html">t-lang/wg-unsafe-code-guidelines</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/breaking.20async.2Fawait.html">breaking async/await</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="173198761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/breaking%20async/await/near/173198761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/breaking.20async.2Fawait.html#173198761">(Aug 14 2019 at 12:44)</a>:</h4>
<p><span class="user-mention" data-user-id="198590">@comex</span> I tried your async/await example without using thread-local storage</p>



<a name="173198795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/breaking%20async/await/near/173198795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/breaking.20async.2Fawait.html#173198795">(Aug 14 2019 at 12:45)</a>:</h4>
<p>(single thread, single task, immutable context, etc.)</p>



<a name="173198870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/breaking%20async/await/near/173198870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/breaking.20async.2Fawait.html#173198870">(Aug 14 2019 at 12:46)</a>:</h4>
<p>but I couldn't manage to get LLVM to misoptimize it</p>



<a name="173198888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/breaking%20async/await/near/173198888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/breaking.20async.2Fawait.html#173198888">(Aug 14 2019 at 12:46)</a>:</h4>
<p>the LLVM-IR emitted for the generator is just too messy</p>



<a name="173200335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/breaking%20async/await/near/173200335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/breaking.20async.2Fawait.html#173200335">(Aug 14 2019 at 13:05)</a>:</h4>
<p>i managed to get llvm to optimize the program to just a ret 0 or ret 1 from main</p>



<a name="173200346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/breaking%20async/await/near/173200346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/breaking.20async.2Fawait.html#173200346">(Aug 14 2019 at 13:05)</a>:</h4>
<p>but I am not able to cause the misoptimization</p>



<a name="173200787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/breaking%20async/await/near/173200787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/breaking.20async.2Fawait.html#173200787">(Aug 14 2019 at 13:10)</a>:</h4>
<p><a href="https://github.com/gnzlbg/break_aw" target="_blank" title="https://github.com/gnzlbg/break_aw">https://github.com/gnzlbg/break_aw</a></p>



<a name="173200808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/breaking%20async/await/near/173200808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/breaking.20async.2Fawait.html#173200808">(Aug 14 2019 at 13:11)</a>:</h4>
<p>i've uploaded it there in case somebody wants to try</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>